<div class="p10t">
    <div id="newsletter-mod" class="bt_nyhed1">
        <h4>NYHEDSBREV TILMELDING</h4>
        <p class="newsletter_text">Tilmeld dig og deltag i lodtrækningen om et gavekort til <span>1000,-</span> hver måned</p>
        <form action="<?php echo str_replace('&', '&amp;', $action); ?>" method="post" enctype="multipart/form-data" id="newsletterForm">
            <input id="subscriber_email" name="subscriber_email" type="text" class="txt_nyhed3" value="Indtast din email adresse..." />
            <!-- input id="subscriber_button" name="subscriber" type="image" src="catalog/view/theme/<?php echo $template; ?>/images/bt_send2.png" / -->
            <!-- input id="unsubscriber_button" name="unsubscriber" type="image" src="catalog/view/theme/<?php echo $template; ?>/images/bt_send3.png" / -->
            <a href="#" name="subscriber" class="submit-btn" id="subscriber_button">Tilmeld</a>
            <a href="#" class="submit-btn" id="unsubscriber_button">Afmeld</a>
        </form>
        
    </div>
</div>
      
<!-- Dialog -->
<div id='confirm'>
	<div class='header'><span>Confirm</span></div>
	<div class='message'></div>
	
	<div class='buttons'>
		<div id="button_continue" class='continue'>Fortsæt</div> 
		<div id="button_no" class='no simplemodal-close'>Nej</div>
		<div id="button_yes" class='yes'>Ja</div> 				 
		<div id="button_yes1" class='yes1'>Ja</div>
	</div>
	<br/>
</div>

<script type="text/javascript">
	//var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;     	
	var mail_filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z]{1,6})+$/;

    jQuery('#subscriber_button').bind('click', function(event){
        event.preventDefault();

        if(!mail_filter.test(jQuery('#subscriber_email').val())){
            confirm('Nyhedsbrev', 'Venligst e-mail skal udfylde.', 'notify');

            return false;
        }

        jQuery.post(
            "<?php echo $subscriber_url; ?>",
            {email: jQuery('#subscriber_email').val(), 'name': jQuery('#subscriber_name').val()},
            function(data){
                confirm('Nyhedsbrev', data, 'notify');

                //jQuery('#subscriber_email').focus();
            }
        );
        jQuery('#subscriber_email').val('');

        return false;
    });

    jQuery('#unsubscriber_button').bind('click', function(event){
        event.preventDefault();

        if(!mail_filter.test(jQuery('#subscriber_email').val())){
            confirm('Nyhedsbrev', 'Venligst e-mail skal udfylde.', 'notify');
            return false;
        }

        jQuery.post(
            "<?php echo $unsubscriber_url; ?>",
            {email: jQuery('#subscriber_email').val()},
            function(data){
                confirm('Nyhedsbrev', data, 'notify');
                //jQuery('#subscriber_email').focus();
            }
        );
        jQuery('#subscriber_email').val('');

        return false;
    });

    jQuery(document).ready(function () {
	    var hint = 'Indtast din email adresse...';
	    jQuery('#subscriber_email').focus(function(e) {
	        if (jQuery(this).val() == hint) {
	            jQuery(this).val('');
	        }
	    });
	    jQuery('#subscriber_email').blur(function(e) {
	        if (jQuery(this).val() == '') {
	            jQuery(this).val(hint);
	        }
	    });
	});
</script>
